<template>
  <div class="navMenu">
    <el-row class="tac">
      <el-col :span="24">
        <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" theme="dark">
          <!--<el-submenu v-for="(menu , index) in menus" v-bind:index="index + 1" v-if="menu.viewShow">-->
          <el-submenu v-for="(menu , index) in menus" v-bind:index="index + 1">
            <template slot="title"><i class="el-icon-message"></i>
              {{ menu.message }}
            </template>
            <el-menu-item-group>
              <router-link v-for="(item , itemIndex) in menu.option" v-bind:to="item.path" class="path-link">
                <!-- 2级索引怎么绑定？？？ -->
                <el-menu-item v-bind:index="(index + 1) + '-' + (itemIndex + 1)">
                  {{ item.optionChoose }}
                </el-menu-item>
              </router-link>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<style>
  .path-link {
    text-decoration: none;
    color: #bfcbd9;
  }
</style>
<script>

  export default{
    name: 'navMenu',
    data(){
      return {
        activeIndex1: '1',
        menus: [
          {
            viewShow: true,
            message: '基础信息管理',
            option: [
              {
                path: '/ProfessionBaseInfo',
                optionChoose: '专业基本信息'
              }, {
                path: '/ClassBaseInfo',
                optionChoose: '班级基本信息'
              }, {
                path: '/TeacherBaseInfo',
                optionChoose: '教师基本信息'
              },
              {
                path: '/StudentBaseInfo',
                optionChoose: '学生基本信息'
              }
            ]
          },
          {
            viewShow: true,
            message: '培养方案管理',
            option: [
              {
                path: '/TrainProgram',
                optionChoose: '培养方案'
              }
            ]
          },
          {
            viewShow: true,
            message: '课程管理',
            option: [
              {
                path: '/TeacherCourseInfo',
                optionChoose: '教师课程表'
              }, {
                path: '/StudentCourseInfo',
                optionChoose: '学生课程表'
              },
              {
                path: '/CourseArrangement',
                optionChoose: '排课管理'
              },
              {
                path: '/CourseExamination',
                optionChoose: '排课审核'
              },
              {
                path: '/AuditSituation',
                optionChoose: '查看审核情况'
              }
            ]
          },
          {
            viewShow: true,
            message: '教材管理',
            option: [
              {
                path: '/TeachMaterialDBManage',
                optionChoose: '教材库管理'
              }, {
                path: '/NewOrder',
                optionChoose: '新增订单'
              }, {
                path: '/ConfirmOrder',
                optionChoose: '确认订单'
              }, {
                path: '/CheckConfirmOrder',
                optionChoose: '查看确认情况'
              }, {
                path: '/HistoryOrder',
                optionChoose: '历史订单'
              }
            ]
          },
          {
            viewShow: true,
            message: '课程设计',
            option: [
              {
                path: '/UploadCourseDesign',
                optionChoose: '上传课设安排'
              },
              {
                path: '/CheckCourseDesign',
                optionChoose: '查看课设安排'
              },
              {
                path: '/CourseDesignTeacher',
                optionChoose: '查看课设安排'
              }
            ]
          },
          {
            viewShow: true,
            message: '毕业设计',
            option: [
              {
                path: '/PublishGraduation',
                optionChoose: '上传毕业设计安排'
              },
              {
                path: '/QueryGraduation',
                optionChoose: '查看毕业设计安排'
              },
              {
                path: '/LookGraduation',
                optionChoose: '查看毕业设计题目'
              },
              {
                path: '/TeacherQueryStudent',
                optionChoose: '教师查看学生'
              },
              {
                path: '/ClassAssociate',
                optionChoose: '教研室分配学生'
              },
              {
                path: '/StudentSelectCourse',
                optionChoose: '学生申请毕设题目'
              },
              {
                path: '/StudentQueryRes',
                optionChoose: '学生查看分配结果'
              },
              {
                path: '/TeacherQueryRes',
                optionChoose: '教师查看分配结果'
              },
              {
                path: '/ClassQueryRes',
                optionChoose: '教研室查看分配结果'
              },
              {
                path: '/ConfirmGraduationRes',
                optionChoose: '查看毕设结果'
              }
            ]
          },
          {
            viewShow: true,
            message: '统计分析',
            option: [
              {
                path: '/TeacherWork',
                optionChoose: '教学工作量统计'
              },
              {
                path: '/TeacherWorkQuery',
                optionChoose: '教学工作量查看'
              },
              {
                path: '/TeacherInfoQuery',
                optionChoose: '教师信息查询'
              },
              {
                path: '/StudentInfoQuery',
                optionChoose: '学生信息查询'
              },
              {
                path: '/MajorPlan',
                optionChoose: '专业培养计划'
              }
            ]
          },
          {
            viewShow: true,
            message: '个人信息',
            option: [
              {
                path: '/StudentInfoManage',
                optionChoose: '学生个人信息'
              },
              {
                path: '/TeacherInfoManage',
                optionChoose: '教师个人信息'
              },
              {
                path: '/ChangePassword',
                optionChoose: '修改密码'
              }
            ]
          },
          {
            viewShow: true,
            message: '系统管理',
            option: [
              {
                path: '/CollegeInit',
                optionChoose: '学院初始化'
              },
              {
                path: '/StudentManage',
                optionChoose: '学生管理'
              },
              {
                path: '/TeacherManage',
                optionChoose: '教师管理'
              },
              {
                path: '/DictionaryManage',
                optionChoose: '字典管理'
              },
              {
                path: '/RoleManage',
                optionChoose: '角色管理'
              }
            ]
          }
        ]
      }
    },
    mounted: function () {
      this.$nextTick(function () {
        this.init();
      })
    },
    methods: {
      init(){
        //this.getMenu()
      },
      getMenu(){
        this.$http.get(this.$until.url + '/menu/getMenu').then(res => {
          this.menus = res.body;
          console.log('文件获取成功');
        }, err => {
          console.log('文件获取失败');
        });
      },
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      }
    }
  }
</script>
